home *** CD-ROM | disk | FTP | other *** search
- Path: docnet.infolink.co.za!julian
- From: julian@docnet.infolink.co.za (Julian van Tubbergh)
- Newsgroups: comp.lang.c
- Subject: Re: GoTo equivalent in C ??
- Date: 24 Jan 1996 05:31:57 GMT
- Organization: No organisation supplied
- Message-ID: <4e4g8d$qbk@hermes.is.co.za>
- References: <4d67vm$e5h@masala.cc.uh.edu> <4d8sa6$mqc@news.iag.net> <4de4ae$h6a@masala.cc.uh.edu> <DLE24I.Jur@thinkage.on.ca>
- NNTP-Posting-Host: docnet.infolink.co.za
- X-Newsreader: TIN [version 1.2 PL2]
-
- Alan Bowler (atbowler@thinkage.on.ca) wrote:
- : In article <4de4ae$h6a@masala.cc.uh.edu> sukku@menudo.uh.edu (sukumar) writes:
- : >
- : >What does everyone do?? I have always been tempted to use goto especially in
- : >functions involving a lot of computation and error checking.
- : >I have heard people say "People who don't know how to code use GOTO". I was
- : >curious to know how guys that say this solve the above problem.
- : >
- : The people who make such blanket statements about goto's are just
- : wrong. Used judiciously, goto's are a valuable part of a programmer's
- : tool kit. It is true that any goto/label pair can be replaced with
- : some set of if/while/flag-variables but applying this approach
- : mechanically results in even worse spaghetti. Back when I was first
- : getting into the buisiness (Before the famous "Goto's considered
- : harmful" letter), a shop I worked at had a style prohibition against
- : switch variables.
-
- : One common case where goto's are often the best choice is the
- : "ooops, something failed, goto common cleanup code" situation.
-
- This is a bit off-topic, but this is exactly the kind of problem that
- exception handling (found in languages like C++ and Delphi) so very
- elegantly solves.
-
- Julian.
-
- ------------------------------------------------------------------------
- Julian van Tubbergh
- IT systems specialist, Promat Colleges, South Africa.
- ------------------------------------------------------------------------
-